<template>
  <view>
    <view class="settle">
      <!-- 全选按钮-->
      <label class="radio" @click="CheckAll()">
        <radio color="#c00000" :checked="isFullChecked" /><text>全选</text>
      </label>
      <!-- 合计-->
      <view class="allPrice">
        合计:<text class="price">￥{{updateAllPrice}}</text>
      </view>
      <!-- 结算按钮-->
      <view class="btn">
        结算({{checkedCount}})
      </view>
    </view>
  </view>
</template>

<script>
  import {
    mapGetters,
    mapMutations
  } from "vuex"
  export default {
    name: "my-settle",
    computed: {
      ...mapGetters('m_cart', ['checkedCount', 'total','updateAllPrice']),
      isFullChecked() {
        return this.checkedCount === this.total
      }
    },
    methods: {
      ...mapMutations('m_cart', ['updateAllCheck']),
      CheckAll() {
        this.updateAllCheck(!this.isFullChecked)
      }
    }
  }
</script>

<style lang="scss">
  .settle {
    position: fixed;
    bottom: 0;
    height: 50px;
    line-height: 50px;
    width: 100%;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;

    .radio {
      padding-left: 10px;
    }

    .allPrice {
      .price {
        color: #c00000;
        font-weight: bold;
      }
    }

    .btn {
      background-color: #c00000;
      width: 100px;
      text-align: center;
      color: white;
    }
  }
</style>
